<? require_once('formvalidator.php');

switch (param('validate')) {
	
	case 'register':
		
		$fields = array(
			'email' => 'req',
			'email' => 'email',
			'password' => 'req',
			'password2' => 'req',
			'password2' => 'eqelmnt=password',
			'lastname' => 'req',
			'firstname' => 'req',
			'region_id' => 'req',
		);

		$val = new FormValidator();
		
		foreach($fields as $f => $v) $val->addValidation($f,$v,'');
		
		if ($val->ValidateForm()) {

		} else {
			
			$r = array();
			$res = $val->GetErrors();

		}
		
		$d = (int)datafetch('value', D_SITEWIDE, 0, 'watchers');
		print php2js(array('stat' => $d));
		exit;

}

foreach(component_fetch() as $component_name => $component_value) {
	@include component_config($component_value['value'].'/user', 'init', array('name' => $component_name));
}
